(* Program 1.2 *)

use "ast.sml";


(* a table is tree of named integers *)
use "ex1b.sml";
type table = int tree;

(* update -- given a table, update the identifier-value binding *)
val rec update : (table * id * int) -> table =
 fn (LEAF, i', z') => TREE (empty, (i', z'), empty)
  | (TREE (l, (i, z), r), i', z') => case String.compare (i', i)
				      of LESS => TREE (update (l, i', z'), (i, z), r)
				       | EQUAL => TREE (l, (i', z'), r)
				       | MORE => TREE (l, (i, z), update (r, i', z'));

(* lookup already exists *)

use "interp.sml";
